package com.atguigu.controller;


import com.atguigu.toolConfig.DateTimeTools;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.deepseek.DeepSeekChatModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ToolController {

    private final DeepSeekChatModel chatModel;

    @Autowired
    public ToolController(DeepSeekChatModel chatModel) {
        this.chatModel = chatModel;
    }

    @GetMapping("/ai/tool")
//    public String tool(@RequestParam(defaultValue = "What day is tomorrow?") String message){
    public String tool(@RequestParam(defaultValue = "Set a user alarm 7 clock AM") String message){
        String response = ChatClient.create(chatModel)
                .prompt(message)
                .tools(new DateTimeTools())
                .call()
                .content();
        return response;
    }
}
